package com.thfw.test.model.bean;

import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;

import scooper.cn.sc_base.log.SCLog;

/**
 * Created BY Cuishikun
 * Created ON 2021/11/29
 * Package Name com.thfw.test.model.bean
 **/
public class RegionBean {


    private String value;

    public String getValue() {
        return value;
    }

    public void setValue(String value) {
        this.value = value;
    }

    public String getParentId() {
        return parentId;
    }

    public void setParentId(String parentId) {
        this.parentId = parentId;
    }

    public String getLabel() {
        return label;
    }

    public void setLabel(String label) {
        this.label = label;
    }

    public String getImg() {
        return img;
    }

    public void setImg(String img) {
        this.img = img;
    }

    private String parentId;
    private String label;
    private String img;

    private ArrayList<RegionBean> children;

    public ArrayList<RegionBean> getChildren() {
        return children;
    }

    public void setChildren(ArrayList<RegionBean> children) {
        this.children = children;
    }



    public static ArrayList<RegionBean> prinfAllRegion(RegionBean bean){
        ArrayList<RegionBean> list =new ArrayList<>();
        if(bean.getChildren()!=null && bean.getChildren().size()==0){
            SCLog.e("cuishikun",bean.getLabel());
            list.add(bean);
        }else{
            list.add(bean);
            SCLog.e("cuishikun",bean.getLabel());
            for(RegionBean bean1 : bean.getChildren()){
                if(bean1.getChildren()!=null && bean1.getChildren().size()!=0){
                    SCLog.e("cuishikun",bean1.getLabel());
                    list.add(bean1);
                    prinfAllRegion(bean1);
                }else{
                    SCLog.e("cuishikun",bean1.getLabel());
                    list.add(bean1);
                }
            }
        }
        return  list;
    }
}
